/* HR表单通用样式组件
------------------------------- */

// 内联表单项样式
.inline-form-item {
  display: inline-block;
  margin: 0;
  position: relative;

  :deep(.el-form-item__content) {
    margin-left: 0;
  }

  :deep(.el-form-item__error) {
    position: absolute;
    top: 100%;
    left: 0;
    white-space: nowrap;
    z-index: 10;
    background: var(--el-bg-color);
    padding: 2px 6px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    font-size: 11px;
    margin-top: 2px;
  }
}

// 日期选择器通用样式
.day-select-compact {
  width: 85px;
  margin-right: 8px;

  :deep(.el-input__wrapper) {
    padding: 0 6px;
  }

  :deep(.el-input__inner) {
    text-align: center;
    font-size: 12px;
  }

  // 确保下拉选项完整显示
  :deep(.el-select-dropdown) {
    min-width: 85px;
  }
}

.day-select-mini {
  width: 100px;
  margin-right: 4px;

  :deep(.el-input__wrapper) {
    padding: 0 4px;
  }

  :deep(.el-input__inner) {
    text-align: center;
    font-size: 11px;
  }

  // 确保下拉选项完整显示
  :deep(.el-select-dropdown) {
    min-width: 75px;
  }
}

// 时间选择器通用样式
.time-picker-compact {
  width: 120px;
}

.time-picker-mini {
  width: 100px;
}

// 打卡时间表格布局
.punch-table {
  .punch-table-header {
    display: flex;
    background: var(--el-fill-color);
    border: 1px solid var(--el-border-color-light);
    border-radius: 4px 4px 0 0;

    .header-col {
      padding: 12px 8px;
      font-weight: 500;
      color: var(--el-text-color-regular);
      text-align: center;

      &.col-type {
        flex: 0 0 80px;
        border-right: 1px solid var(--el-border-color-light);
      }

      &.col-worktime {
        flex: 0 0 200px;
        border-right: 1px solid var(--el-border-color-light);
      }

      &.col-punchtime {
        flex: 1;
      }
    }
  }

  .punch-table-row {
    display: flex;
    border: 1px solid var(--el-border-color-light);
    border-top: none;
    background: var(--el-bg-color);

    &:hover {
      background: var(--el-fill-color-lighter);
    }

    .row-col {
      padding: 12px 8px;
      display: flex;
      align-items: center;

      &.col-type {
        flex: 0 0 80px;
        border-right: 1px solid var(--el-border-color-light);
        justify-content: center;
      }

      &.col-worktime {
        flex: 0 0 200px;
        border-right: 1px solid var(--el-border-color-light);
        justify-content: center;
      }

      &.col-punchtime {
        flex: 1;
        justify-content: center;
      }
    }
  }
}

// 类型标签样式
.type-label {
  display: flex;
  align-items: center;
  gap: 4px;

  .type-icon {
    font-size: 16px;

    &.work-start {
      color: var(--el-color-success);
    }

    &.work-end {
      color: var(--el-color-warning);
    }
  }
}

// 工作时间和打卡时间组样式
.worktime-group,
.punchtime-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.time-group {
  display: flex;
  align-items: center;
  gap: 4px;
}

// 范围分隔符
.range-separator {
  color: var(--el-text-color-placeholder);
  font-weight: bold;
  margin: 0 4px;
}

// 响应式设计 - 移动端优化
@media (max-width: 768px) {
  .punch-table {

    .punch-table-header,
    .punch-table-row {
      flex-direction: column;
      gap: 8px;
    }

    .col-type,
    .col-worktime,
    .col-punchtime {
      width: 100% !important;
      min-width: auto !important;
      border-right: none !important;
    }

    .punchtime-range {
      flex-direction: column;
      gap: 8px;
      align-items: flex-start;
    }

    .time-group {
      width: 100%;
      justify-content: space-between;
    }

    .day-select-compact,
    .time-picker-compact,
    .day-select-mini,
    .time-picker-mini {
      width: 100%;
    }
  }

  .inline-form-item {
    display: block;
    margin-bottom: 16px;
  }
}

@media (max-width: 480px) {
  .time-group {
    flex-direction: column;
    gap: 4px;
    align-items: stretch;
  }

  .day-select-compact,
  .day-select-mini {
    width: 100%;
    margin-right: 0;
    margin-bottom: 4px;
  }

  .time-picker-compact,
  .time-picker-mini {
    width: 100%;
  }

  .range-separator {
    margin: 4px 0;
    text-align: center;
  }
}

// 暗黑模式适配
[data-theme='dark'] {
  .punch-table {
    .punch-table-header {
      background: var(--next-color-hover) !important;
      border-color: var(--next-border-color) !important;
      color: var(--next-text-color-regular) !important;

      .header-col {
        border-right-color: var(--next-border-color) !important;
      }
    }

    .punch-table-row {
      background: var(--next-color-disabled) !important;
      border-color: var(--next-border-color) !important;

      &:hover {
        background: var(--next-color-hover) !important;
      }

      .row-col {
        border-right-color: var(--next-border-color) !important;
      }
    }
  }

  .type-label {
    color: var(--next-color-bar) !important;
  }

  .range-separator {
    color: var(--next-text-color-placeholder) !important;
  }
}
